|
|
Dear Mike and Chris,
Chris, I tried your script, but the transition between points with different
widths seems too abrupt (but thanks anyway!).
So I think I will use Mike's tool. However, I found a few things that 'bothered'
me here:
1) The spline that handles the width does not seem to correspond with the real
width (as obtained, for instance, with the 'sphere' object). Some spline issue?
2) The end point seems to be off (not at the right position) and varies, for
instance, according to the 'number-of-Upoints' parameter. Again, spline
related?
3) How do I close the tubes, i.e., put end-caps on it? I guess a sphere or
cylinder does the job, but it is not trivial, given point 1).
I added a toy example below - any suggestions on how to fine-tune the result
that tackles the issues above?
Again - much appreciated!
Alex
//--------------------
camera {orthographic location <3, 4, 10> look_at <3, 4, 0> angle 50}
light_source {<3,4,1000> colour rgb <1,1,1>}
#declare tube_width=0.3;
#declare USpline =
spline {
natural_spline // using 'cubic_spline' gives an error?!
0, < 5, 6, 0>,
0.25, < 4, 5, 0>,
0.5, < 3, 4, 0>,
0.75, < 2, 3, 0>,
1, < 1, 2, 0>,
}
// I added a few extra points to make it look more 'circular'...
#declare VSpline =
spline {
cubic_spline
-0.125, <0.7071,-0.7071,0>,
0, < 1, 0,0>,
0.125, <0.7071,0.7071,0>,
0.25, < 0, 1,0>,
0.375, <-0.7071,0.7071,0>,
0.5, <-1, 0,0>,
0.625, <-0.7071,-0.7071,0>,
0.75, < 0,-1,0>,
0.875, <0.7071,-0.7071,0>,
1, < 1, 0,0>,
1.125, <0.7071,0.7071,0>,
}
#declare WSpline = spline {
cubic_spline
0, tube_width,
0.25, tube_width,
0.5, 5*tube_width,
0.75, tube_width,
1, tube_width,
}
#declare Upoints = 50; // change this to 10 and something strange happens (why
does it get shorter?)
#declare Vpoints = 50; // Number of points around
#declare Filename = ""
#include "SweepSpline.inc"
object {
SweepSpline(USpline, VSpline, WSpline, Upoints, Vpoints, Filename)
pigment { uv_mapping
function{u}
colour_map {[0 rgb<1,0,0>]
[0.25 rgb<0,1,0>]
[0.5 rgb<1,0,1>]
[0.75 rgb<0,1,1>]
[1 rgb<1,1,0>]}}
finish {phong 0.5 phong_size 10}
}
sphere {<5,6,0> ,tube_width pigment { rgb <1,1,1> }}
sphere {<1, 2, 0> ,tube_width pigment { rgb <1,1,1> }}
//--------------------
Post a reply to this message
|
|